package com.example.cooldemo;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.example.cool_core.config.CoolViewConfig;

public class DefaultTopBaseActivity extends BaseActivity {

    @Override
    protected int setLayoutId(Bundle savedInstanceState) {
        CoolViewConfig.getInstance()
                .setDefault();
        return R.layout.activity_top_base;
    }

    @Override
    protected int setLoadingRootLayout() {
        return R.id.layout_root;
    }

    @Override
    protected void init(Bundle savedInstanceState) {
        super.init(savedInstanceState);
        mPublicConfig.setTopBar("demo");
        final TextView tv_but = findViewById(R.id.tv_but);
        tv_but.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (tv_but.getText().toString()) {
                    case "1":
                        mPublicConfig.showLoading();
                        tv_but.setText("2");
                        break;
                    case "2":
                        mPublicConfig.showError();
                        tv_but.setText("3");
                        break;
                    case "3":
                        mPublicConfig.showContent();
                        tv_but.setText("1");
                        break;
                }

            }
        });
    }
}
